﻿Public Class DataBuilder

    Public Function CreateTwoByte(ByVal ValueA As Integer, ByVal ValueB As Integer) As Byte()
        Dim B(1) As Byte
        B(0) = CByte(ValueA)
        B(1) = CByte(ValueB)
        Return B
    End Function
    Public Function CreateThreeByte(ByVal ValueA As Integer, ByVal ValueB As Integer) As Byte()
        Dim B(2) As Byte
        Dim S As String = Convert.ToString(ValueB, 2).PadLeft(16, "0")
        Dim B1 As Byte = Convert.ToByte(S.Substring(0, 8), 2)
        Dim B2 As Byte = Convert.ToByte(S.Substring(8, 8), 2)
        B(0) = CByte(ValueA)
        B(1) = CByte(B1)
        B(2) = CByte(B2)
        Return B
    End Function
End Class
